<?php
/**
 * Created by PhpStorm.
 * User: Huyang
 * Date: 2016/9/20
 * Time: 13:28
 */

namespace App\Http\Requests\Admin;

use App\Exceptions\ServiceException;
use App\Http\Constants\CommonExceptionConstants;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;

class SystemContext
{

    private $id;

    private $name;

    private $mobile;

    public function __construct(Request $request)
    {

        if (!$request->userId) {
            throw new ServiceException(CommonExceptionConstants::getKey('no_login'));
        }

        Redis::get('User:'.$request->userId);

    }

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param mixed $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @param mixed $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * @return mixed
     */
    public function getMobile()
    {
        return $this->mobile;
    }

    /**
     * @param mixed $mobile
     */
    public function setMobile($mobile)
    {
        $this->mobile = $mobile;
    }

}